﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Cash5
{
    public partial class ShowAll : Form
    {
        private string txt;
        public ShowAll(string text)
        {
            this.txt = text;
            
            InitializeComponent();
        }

        private void ShowAll_Load(object sender, EventArgs e)
        {
            this.textBox1.Text = txt;
        }

        private void btPrint_Click(object sender, EventArgs e)
        {
            //PrintDialog associate with PrintDocument;
            printDialog1.Document = printDocument1;

            if (printDialog1.ShowDialog() == DialogResult.OK)
            {
                printDocument1.Print();
            }
        }

        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            e.Graphics.DrawString(textBox1.Text, textBox1.Font, Brushes.Black, 100, 20);
            e.Graphics.PageUnit = GraphicsUnit.Inch;    

        }

        private void btPreview_Click(object sender, EventArgs e)
        {
            printPreviewDialog1.Document = printDocument1;

            //printPreviewDialog1.PrintPreviewControl.StartPage = 1;
            //printPreviewDialog1.P
           // printPreviewDialog1.PrintPreviewControl.Columns = 1;
            // Show PrintPreview Dialog
            printPreviewDialog1.ShowDialog();
        }
    }
}
